﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CarManage_YearMonthModeWebForm.aspx.cs" Inherits="Anke.SHManage.Web.Reports.CarManage_YearMonthModeWebForm" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><%=Title%></title>
    <script src="../Content/EasyUI/jquery.js"></script>
    <script src="../Content/EasyUI/jquery.easyui.js"></script>
    <script src="../Content/EasyUI/locale/easyui-lang-zh_CN.js"></script>
    <link href="../Content/EasyUI/themes/icon.css" rel="stylesheet" />
    <link href="../Content/EasyUI/themes/default/easyui.css" rel="stylesheet" />
    <script src="../Scripts/jquery.AnkeExtend.js"></script>
    <script type="text/javascript">
        //页面加载
        $(document).ready(function () {
            //$.InitMonthFirstDateTime();
            DisableBackspace();
            reload();
        });

        function EUIcombobox(jqS, o) {
            $.ajax({
                type: "POST",
                async: false,
                url: o.url,
                dataType: "JSON",
                success: function (data1, textStatus, jqXHR) {
                    o.data = o.OneOption.concat(data1);
                    delete o.url;
                    delete o.OneOption;
                    $(jqS).combobox(o);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert("获取字典数据失败！可能是已经超时，请重新登录！");
                }
            });
        }

        function fillCombobox() {

            //取所属分中心的下拉框的值
            $("#Center").combobox({
                url: "../BB/AllDictionary/GetCenterName",
                valueField: 'ID',
                textField: 'Name',
                editable: false,
                multiple: true,
                prompt: '--请选择--',
                onSelect: function (rec) {
                    var ids = $('#Center').combobox('getValues');
                    //根据分中心取分站
                    $("#Station").combobox({
                        url: "../BB/AllDictionary/GetSationName?centerID=" + ids,
                        method: 'POST',
                        valueField: 'ID',
                        textField: 'Name',
                        multiple: true,
                        editable: false,
                        onSelect: function (rec) {
                            var ids = $('#Station').combobox('getValues');
                            var zz = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + ids;
                            EUIcombobox("#zPlateNumber", {
                                url: zz,
                                valueField: 'AmbulanceCode',
                                textField: 'PlateNumber',
                                editable: false,
                                multiple: true,
                                OneOption: [{
                                    AmbulanceCode: "",
                                    PlateNumber: "--请选择--"
                                }], onSelect: function () {
                                    $("#zPlateNumber").combobox('getValues');
                                }, onUnselect: function (rec) {
                                    $("#zPlateNumber").combobox('getValues');
                                }

                            });
                        },
                        onUnselect: function (rec) {
                            var ids = $('#Station').combobox('getValues');
                            var zz = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + ids;
                            EUIcombobox("#zPlateNumber", {
                                url: zz,
                                valueField: 'AmbulanceCode',
                                textField: 'PlateNumber',
                                editable: false,
                                multiple: true,
                                OneOption: [{
                                    AmbulanceCode: "",
                                    PlateNumber: "--请选择--"
                                }]
                            });

                        }
                    });
                    $("#Station").combobox('clear');
                    $("#zPlateNumber").combobox('clear');
                },
                onUnselect: function (rec) {
                    var ids = $('#Center').combobox('getValues');
                    //根据分中心取分站
                    $("#Station").combobox({
                        url: "../BB/AllDictionary/GetSationName?centerID=" + ids,
                        method: 'POST',
                        valueField: 'ID',
                        textField: 'Name',
                        multiple: true,
                        editable: false
                    });

                    var stationids = $('#Station').combobox('getValues');
                    var zzb = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + stationids;
                    EUIcombobox("#zPlateNumber", {
                        url: zzb,
                        valueField: 'AmbulanceCode',
                        textField: 'PlateNumber',
                        editable: false,
                        multiple: true,
                        OneOption: [{
                            AmbulanceCode: "",
                            PlateNumber: "--请选择--"
                        }]
                    });

                    $("#Station").combobox('clear');
                    $("#zPlateNumber").combobox('clear');
                },
            });




            var centers = $('#Center').combobox('getValues');
            $("#Station").combobox({
                url: "../BB/AllDictionary/GetSationName?centerID=" + centers,
                method: 'POST',
                valueField: 'ID',
                textField: 'Name',
                multiple: true,
                editable: false,
                onSelect: function (rec) {

                    var idds = $('#Station').combobox('getValues');

                    var zz = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + idds;
                    EUIcombobox("#zPlateNumber", {
                        url: zz,
                        valueField: 'AmbulanceCode',
                        textField: 'PlateNumber',
                        editable: false,
                        multiple: true,
                        OneOption: [{
                            AmbulanceCode: "",
                            PlateNumber: "--请选择--"
                        }], onSelect: function () {
                            $("#zPlateNumber").combobox('getValues');
                        }, onUnselect: function (rec) {
                            $("#zPlateNumber").combobox('getValues');
                        }
                    });
                    $("#zPlateNumber").combobox('clear');
                },
                onUnselect: function (rec) {
                    var idds = $('#Station').combobox('getValues');
                    var zz = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + idds;
                    EUIcombobox("#zPlateNumber", {
                        url: zz,
                        valueField: 'AmbulanceCode',
                        textField: 'PlateNumber',
                        editable: false,
                        multiple: true,
                        OneOption: [{
                            AmbulanceCode: "",
                            PlateNumber: "--请选择--"
                        }], onSelect: function () {
                            $("#zPlateNumber").combobox('getValues');
                        }, onUnselect: function (rec) {
                            $("#zPlateNumber").combobox('getValues');
                        }
                    });

                    $("#zPlateNumber").combobox('clear');
                }
            });



            var stationids = $('#Station').combobox('getValues');
            var zzb = "../CM/CarBasicInfo/getPlateByStationID?stationCode=" + stationids;
            EUIcombobox("#zPlateNumber", {
                url: zzb,
                valueField: 'AmbulanceCode',
                textField: 'PlateNumber',
                editable: false,
                multiple: true,
                OneOption: [{
                    AmbulanceCode: "",
                    PlateNumber: "--请选择--"
                }], onSelect: function () {
                    $("#zPlateNumber").combobox('getValues');
                }, onUnselect: function () {
                    $("#zPlateNumber").combobox('getValues');
                }
            });
        }

        // 实现UpdatePanel中可以再添加easyUI的样式
        function reload() {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        }
        function EndRequestHandler() {
            fillCombobox();

            $('#StartDate').datebox();
            $('#EndDate').datebox();
            $('#zPlateNumber').combobox();
            //$('#txtDoctorAndNurse').textbox();
            //$('#txtMeasures').textbox();
            //$('#txtFirstImpression').textbox();
            //$('#txtSendAddress').textbox();
        }

    </script>


</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <table>
                        <tr>
                            <td style="text-align: left; font-size: small;">查询时间:</td>
                            <td>
                                <asp:TextBox ID="StartDate" class="easyui-datebox" Style="width: 120px" runat="server"></asp:TextBox>
                            </td>
                            <td style="text-align: right; font-size: small;">至:</td>
                            <td>
                                <asp:TextBox ID="EndDate" class="easyui-datebox" Style="width: 120px" runat="server"></asp:TextBox>
                            </td>
                            <td style="text-align: left; font-size: small;">分中心：</td>
                            <td>
                                <asp:TextBox ID="Center" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                            </td>
                            <td style="text-align: left; font-size: small;">分站：</td>
                            <td>
                                <asp:TextBox ID="Station" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                            </td>
                            <td style="text-align: left; font-size: small;">车牌号码：</td>
                            <td>
                                <asp:TextBox ID="zPlateNumber" class="easyui-combobox" Style="width: 150px" runat="server"></asp:TextBox>
                            </td>
                            <td>
                                <asp:Button ID="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>

            </asp:UpdatePanel>
            <div style="background-color: #fafafa; border-left: 1px solid scrollbar; height: 100%;">
                <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%" Height="100%"   SizeToReportContent="True">
                </rsweb:ReportViewer>
            </div>
        </div>
    </form>
</body>
</html>
